<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('项目列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">

    <div class="row">
        <!-- 搜索栏 -->
        <div class="col-sm-12 search-collapse">
            <form id="project-form">
                <div class="select-list">
                    <ul>
                        <li>
                            项目名称：<input type="text" name="pname"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <!-- 数据网格 -->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:role:edit')}]];
    var detailFlag = [[${@permission.hasPermi('monitor:job:detail')}]];
    var prefix = ctx + "cms/pm";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            removeUrl: prefix + "/remove",
            updateUrl: prefix + "/edit/{id}",
            detailUrl: prefix + "/detail/{id}",
            sortName: "projectStartTime",
            sortOrder: "desc",
            modalName: "项目类别",
            columns: [
                {
                    checkbox: true
                }, {
                    field: 'pid',
                    title: '项目编号'
                }, {
                    field: 'pname',
                    title: '项目名称',
                }, {
                    field: 'projectType',
                    title: '项目类别',
                }, {
                    field: 'customer.cname',
                    title: '所属客户',
                }, {
                    field: 'pstatus',
                    title: '项目状态',
                    formatter: function (value, item, index) {
                        if (value == 0) {
                            return "项目启动,任务未分配";
                        } else if (value == 1) {
                            return "项目进行";
                        } else if (value == 2) {
                            return "项目完成";
                        } else if (value == 3) {
                            return "项目撤销";
                        }else {
                            return "项目归档";
                        }
                    }
                }, {
                    field: 'projectCreator',
                    title: '创建人',
                }, {
                    field: 'projectStartTime',
                    title: '创建时间',
                    sortable: true
                }, {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.pid + '\')"><i class="fa fa-search"></i>查看</a> ');
                        actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.pid + '\')"><i class="fa fa-eye"></i>进度查询</a> ');
                        actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.pid + '\')"><i class="fa fa-fighter-jet"></i>进度验收</a> ');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>